<template>
  <view>
    <view class="image-box c-mt100">
      <view class="null c-fw600">目前暂无订单</view>
      <image class="kong c-mt40" src="/static/image/kong.png" mode="" />
      <view class="button-box" @click="toHome">
        <l-button @navTo="toHome" text="去商城看看吧"></l-button>
      </view>
    </view>
    <view class="c-p15 c-bg-white">
      <view class="c-flex c-flex-between">
        <view class="c-fw600 c-fs-32">可能你会喜欢</view>
        <view @click="toList" class="c-fw600 c-fs-32">查看更多</view>
      </view>
      <view>
        <GoodList
          :data="data2"
          keys="id"
          mainTitleValue="effectList"
          bgimg="pic"
          :iconimgBoo="false"
          viceTitleValue="name"
          moneyValue="price"
          :pageView="true"
          shoppingNum="sale"
          viewNum="look"
          moneySymbol="￥"
          @navTo="navTo"
        />
      </view>
    </view>
  </view>
</template>

<script>
  import lButton from './../../commponents/public/button/SaveButton'
  import GoodList from '@/commponents/public/goodsList'
  import goods from '@/services/goods'
  export default {
    components: {
      lButton,
      GoodList
    },
    data() {
      return {
        wNum: '',
        data2: [],
        scrollCol: ''
      }
    },
    methods: {
      toHome() {
        wx.switchTab({
          url: `/pages/index/index`
        })
      },
      navTo(data) {
        wx.navigateTo({
          url: `/pages/productDetails/index?id=${data}`
        })
      },
      toList() {
        wx.navigateTo({
          url: `/pages/productList/index`
        })
      },
      newGoodsList() {
        goods
          .list({
            isNew: 1
          })
          .then(res => {
            this.data2 = res.list
            this.wNum = this.data2.length * 40
            this.scrollCol = this.data2.length
          })
      }
    },
    mounted() {
      this.newGoodsList()
    }
  }
</script>
<style lang="scss" scoped>
  .image-box {
    text-align: center;
  }
  .null {
    color: #b7b7b7;
    font-size: 32rpx;
  }
  .kong {
    width: 40vw;
    height: 28vw;
  }
  .c-fs-32 {
    font-size: 32rpx;
  }
</style>
>
